package com.tom.architect02.p4.day37.retrofit;


public interface ParameterHandler<T> {
     void apply(RequestBuilder requestBuilder, T value);

    // 策略。Query，Part，QueryMap,Field...
    class Query<T> implements ParameterHandler<T> {
        private final String key; // 保存的就是参数key=username，password

        public Query(String key) {
            this.key = key;
        }

        @Override
        public void apply(RequestBuilder requestBuilder, T value) {
            // 添加到request中:  value -> String 要经过一个工厂
            //（源码 okhttp:ParameterHandler/Query/apply() ）=> valueConverter.convert(value)
            requestBuilder.addQueryName(key, value.toString());
        }
    }
    // Part，QueryMap,Field..........

}
